<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('解决方案列表')" />
</head>
<body class="gray-bg">
  <div class="container-div">
		<div class="row">
      <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="sewage:sewagePlan:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editTab()" shiro:hasPermission="sewage:sewagePlan:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="sewage:sewagePlan:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('sewage:sewagePlan:edit')}]];
        var removeFlag = [[${@permission.hasPermi('sewage:sewagePlan:remove')}]];
        var prefix = ctx + "sewage/sewagePlan";

        $(function () {
          var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "解决方案",
            columns: [{
              checkbox: true
            },
              {
                field: 'planId',
                title: '项目方案ID',
                visible: false
              },
              {
                field: 'planName',
                title: '方案名称',
                sortable: true
              },
              {
                field : 'createBy',
                title : '创建者'
              },
              {
                field: 'createTime',
                title: '创建时间',
                sortable: true
              },
              {
                title: '操作',
                align: 'center',
                formatter: function (value, row, index) {
                  var actions = [];
                  actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.planId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                  actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="assignMicro(\'' + row.planId + '\')"><i class="fa fa-edit"></i>指定产品</a> ');
                  actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="assignProject(\'' + row.planId + '\')"><i class="fa fa-edit"></i>指定案例</a> ');
                  actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.planId + '\')"><i class="fa fa-remove"></i>删除</a>');
                  return actions.join('');
                }
              }]
          };
          $.table.init(options);
        });

        function assignMicro(planId) {
          var url = prefix + '/assignMicro/'+planId;
          $.modal.openTab("指定产品", url);
        }

        function assignProject(planId) {
          var url = prefix + '/assignProject/'+planId;
          $.modal.openTab("指定案例", url);
        }
    </script>
</body>
</html>